﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Configuration;
using System.Data;
using System.Data.Common;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Data.SQLite.EF6;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace Broswer
{
    /// <summary>
    /// App.xaml 的交互逻辑
    /// </summary>
    public partial class App : Application
    {
    }
    public class BroswerContext : DbContext
    {
        static string dbPath = $"Data Source=E:\\pcBroswer\\Broswer\\Websites.db";
        public static BroswerContext Instance
        {
            get
            {
                DbConnection sqliteCon = SQLiteProviderFactory.Instance.CreateConnection();
                sqliteCon.ConnectionString = dbPath;
               
                return new BroswerContext(sqliteCon);
            }
        }
        private BroswerContext(DbConnection con) : base(con, true) { }
        public DbSet<NavigateSites> NavigateSiteslist { get; set; }
        public DbSet<student> student { get; set; }
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
        }
    }
    [Table("NavigateSites")]
    public class NavigateSites
    {
        [Key]
        public int ID { get; set; }       
        public string Name { get; set; }        
    }
    public class student
    {
        [Key]
        [Column("name")]
        public string name { get; set; }
    }
}
